home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / menus.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  11.1 KB  |  273 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1998 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'Menus.pas' rev: 3.00
  6.  
  7. #ifndef MenusHPP
  8. #define MenusHPP
  9. #include <Messages.hpp>
  10. #include <Classes.hpp>
  11. #include <SysUtils.hpp>
  12. #include <Windows.hpp>
  13. #include <SysInit.hpp>
  14. #include <System.hpp>
  15.  
  16. //-- user supplied -----------------------------------------------------------
  17.  
  18. namespace Menus
  19. {
  20. //-- type declarations -------------------------------------------------------
  21. class DELPHICLASS EMenuError;
  22. class PASCALIMPLEMENTATION EMenuError : public Sysutils::Exception 
  23. {
  24.     typedef Sysutils::Exception inherited;
  25.     
  26. public:
  27.     /* Exception.Create */ __fastcall EMenuError(const System::AnsiString Msg) : Sysutils::Exception(Msg
  28.         ) { }
  29.     /* Exception.CreateFmt */ __fastcall EMenuError(const System::AnsiString Msg, const System::TVarRec 
  30.         * Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  31.     /* Exception.CreateRes */ __fastcall EMenuError(int Ident, Extended Dummy) : Sysutils::Exception(Ident
  32.         , Dummy) { }
  33.     /* Exception.CreateResFmt */ __fastcall EMenuError(int Ident, const System::TVarRec * Args, const int 
  34.         Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  35.     /* Exception.CreateHelp */ __fastcall EMenuError(const System::AnsiString Msg, int AHelpContext) : 
  36.         Sysutils::Exception(Msg, AHelpContext) { }
  37.     /* Exception.CreateFmtHelp */ __fastcall EMenuError(const System::AnsiString Msg, const System::TVarRec 
  38.         * Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  39.         ) { }
  40.     /* Exception.CreateResHelp */ __fastcall EMenuError(int Ident, int AHelpContext) : Sysutils::Exception(
  41.         Ident, AHelpContext) { }
  42.     /* Exception.CreateResFmtHelp */ __fastcall EMenuError(int Ident, const System::TVarRec * Args, const 
  43.         int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext) { }
  44.     
  45. public:
  46.     /* TObject.Destroy */ __fastcall virtual ~EMenuError(void) { }
  47.     
  48. };
  49.  
  50. enum TMenuBreak { mbNone, mbBreak, mbBarBreak };
  51.  
  52. typedef Word TShortCut;
  53.  
  54. typedef void __fastcall (__closure *TMenuChangeEvent)(System::TObject* Sender, bool Rebuild);
  55.  
  56. class DELPHICLASS TMenuItem;
  57. class DELPHICLASS TMenu;
  58. enum TFindItemKind { fkCommand, fkHandle, fkShortCut };
  59.  
  60. class PASCALIMPLEMENTATION TMenu : public Classes::TComponent 
  61. {
  62.     typedef Classes::TComponent inherited;
  63.     
  64. private:
  65.     TMenuItem* FItems;
  66.     HWND FWindowHandle;
  67.     System::AnsiString FMenuImage;
  68.     void __fastcall SetWindowHandle(HWND Value);
  69.     bool __fastcall UpdateImage(void);
  70.     
  71. protected:
  72.     virtual void __fastcall MenuChanged(System::TObject* Sender, bool Rebuild);
  73.     DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root);
  74.     virtual HMENU __fastcall GetHandle(void);
  75.     DYNAMIC void __fastcall SetChildOrder(Classes::TComponent* Child, int Order);
  76.     
  77. public:
  78.     __fastcall virtual TMenu(Classes::TComponent* AOwner);
  79.     __fastcall virtual ~TMenu(void);
  80.     bool __fastcall DispatchCommand(Word ACommand);
  81.     bool __fastcall DispatchPopup(HMENU AHandle);
  82.     TMenuItem* __fastcall FindItem(int Value, TFindItemKind Kind);
  83.     Classes::THelpContext __fastcall GetHelpContext(int Value, bool ByCommand);
  84.     bool __fastcall IsShortCut(Messages::TWMKey &Message);
  85.     __property HMENU Handle = {read=GetHandle, nodefault};
  86.     __property HWND WindowHandle = {read=FWindowHandle, write=SetWindowHandle, nodefault};
  87.     
  88. __published:
  89.     __property TMenuItem* Items = {read=FItems};
  90. };
  91.  
  92. class PASCALIMPLEMENTATION TMenuItem : public Classes::TComponent 
  93. {
  94.     typedef Classes::TComponent inherited;
  95.     
  96. private:
  97.     System::AnsiString FCaption;
  98.     HMENU FHandle;
  99.     bool FChecked;
  100.     bool FEnabled;
  101.     bool FDefault;
  102.     bool FRadioItem;
  103.     bool FVisible;
  104.     Byte FGroupIndex;
  105.     TMenuBreak FBreak;
  106.     Word FCommand;
  107.     Classes::THelpContext FHelpContext;
  108.     System::AnsiString FHint;
  109.     Classes::TList* FItems;
  110.     TShortCut FShortCut;
  111.     TMenuItem* FParent;
  112.     TMenuItem* FMerged;
  113.     TMenuItem* FMergedWith;
  114.     TMenu* FMenu;
  115.     TMenuChangeEvent FOnChange;
  116.     Classes::TNotifyEvent FOnClick;
  117.     void __fastcall AppendTo(HMENU Menu);
  118.     void __fastcall ClearHandles(void);
  119.     void __fastcall ReadShortCutText(Classes::TReader* Reader);
  120.     void __fastcall MergeWith(TMenuItem* Menu);
  121.     void __fastcall RebuildHandle(void);
  122.     void __fastcall PopulateMenu(void);
  123.     void __fastcall SubItemChanged(System::TObject* Sender, bool Rebuild);
  124.     void __fastcall TurnSiblingsOff(void);
  125.     void __fastcall WriteShortCutText(Classes::TWriter* Writer);
  126.     void __fastcall VerifyGroupIndex(int Position, Byte Value);
  127.     
  128. protected:
  129.     virtual void __fastcall DefineProperties(Classes::TFiler* Filer);
  130.     HMENU __fastcall GetHandle(void);
  131.     int __fastcall GetCount(void);
  132.     DYNAMIC void __fastcall GetChildren(Classes::TGetChildProc Proc, Classes::TComponent* Root);
  133.     TMenuItem* __fastcall GetItem(int Index);
  134.     int __fastcall GetMenuIndex(void);
  135.     DYNAMIC Classes::TComponent* __fastcall GetParentComponent(void);
  136.     virtual void __fastcall MenuChanged(bool Rebuild);
  137.     DYNAMIC bool __fastcall HasParent(void);
  138.     void __fastcall SetBreak(TMenuBreak Value);
  139.     void __fastcall SetCaption(const System::AnsiString Value);
  140.     void __fastcall SetChecked(bool Value);
  141.     DYNAMIC void __fastcall SetChildOrder(Classes::TComponent* Child, int Order);
  142.     void __fastcall SetDefault(bool Value);
  143.     void __fastcall SetEnabled(bool Value);
  144.     void __fastcall SetGroupIndex(Byte Value);
  145.     void __fastcall SetMenuIndex(int Value);
  146.     DYNAMIC void __fastcall SetParentComponent(Classes::TComponent* Value);
  147.     void __fastcall SetRadioItem(bool Value);
  148.     void __fastcall SetShortCut(TShortCut Value);
  149.     void __fastcall SetVisible(bool Value);
  150.     
  151. public:
  152.     __fastcall virtual TMenuItem(Classes::TComponent* AOwner);
  153.     __fastcall virtual ~TMenuItem(void);
  154.     HIDESBASE void __fastcall Insert(int Index, TMenuItem* Item);
  155.     void __fastcall Delete(int Index);
  156.     virtual void __fastcall Click(void);
  157.     int __fastcall IndexOf(TMenuItem* Item);
  158.     void __fastcall Add(TMenuItem* Item);
  159.     HIDESBASE void __fastcall Remove(TMenuItem* Item);
  160.     __property Word Command = {read=FCommand, nodefault};
  161.     __property HMENU Handle = {read=GetHandle, nodefault};
  162.     __property int Count = {read=GetCount, nodefault};
  163.     __property TMenuItem* Items[int Index] = {read=GetItem/*, default*/};
  164.     __property int MenuIndex = {read=GetMenuIndex, write=SetMenuIndex, nodefault};
  165.     __property TMenuItem* Parent = {read=FParent};
  166.     
  167. __published:
  168.     __property TMenuBreak Break = {read=FBreak, write=SetBreak, default=0};
  169.     __property System::AnsiString Caption = {read=FCaption, write=SetCaption};
  170.     __property bool Checked = {read=FChecked, write=SetChecked, default=0};
  171.     __property bool Default = {read=FDefault, write=SetDefault, default=0};
  172.     __property bool Enabled = {read=FEnabled, write=SetEnabled, default=1};
  173.     __property Byte GroupIndex = {read=FGroupIndex, write=SetGroupIndex, default=0};
  174.     __property Classes::THelpContext HelpContext = {read=FHelpContext, write=FHelpContext, default=0};
  175.     __property System::AnsiString Hint = {read=FHint, write=FHint};
  176.     __property bool RadioItem = {read=FRadioItem, write=SetRadioItem, default=0};
  177.     __property TShortCut ShortCut = {read=FShortCut, write=SetShortCut, default=0};
  178.     __property bool Visible = {read=FVisible, write=SetVisible, default=1};
  179.     __property Classes::TNotifyEvent OnClick = {read=FOnClick, write=FOnClick};
  180. };
  181.  
  182. class DELPHICLASS TMainMenu;
  183. class PASCALIMPLEMENTATION TMainMenu : public Menus::TMenu 
  184. {
  185.     typedef Menus::TMenu inherited;
  186.     
  187. private:
  188.     HMENU FOle2Menu;
  189.     bool FAutoMerge;
  190.     void __fastcall ItemChanged(void);
  191.     void __fastcall SetAutoMerge(bool Value);
  192.     
  193. protected:
  194.     virtual void __fastcall MenuChanged(System::TObject* Sender, bool Rebuild);
  195.     virtual HMENU __fastcall GetHandle(void);
  196.     
  197. public:
  198.     void __fastcall Merge(TMainMenu* Menu);
  199.     void __fastcall Unmerge(TMainMenu* Menu);
  200.     void __fastcall PopulateOle2Menu(HMENU SharedMenu, const int * Groups, const int Groups_Size, int * 
  201.         Widths, const int Widths_Size);
  202.     void __fastcall GetOle2AcceleratorTable(HACCEL &AccelTable, int &AccelCount, const int * Groups, const 
  203.         int Groups_Size);
  204.     void __fastcall SetOle2MenuHandle(HMENU Handle);
  205.     
  206. __published:
  207.     __property bool AutoMerge = {read=FAutoMerge, write=SetAutoMerge, default=0};
  208. public:
  209.     /* TMenu.Create */ __fastcall virtual TMainMenu(Classes::TComponent* AOwner) : Menus::TMenu(AOwner)
  210.          { }
  211.     /* TMenu.Destroy */ __fastcall virtual ~TMainMenu(void) { }
  212.     
  213. };
  214.  
  215. enum TPopupAlignment { paLeft, paRight, paCenter };
  216.  
  217. class DELPHICLASS TPopupMenu;
  218. class PASCALIMPLEMENTATION TPopupMenu : public Menus::TMenu 
  219. {
  220.     typedef Menus::TMenu inherited;
  221.     
  222. private:
  223.     TPopupAlignment FAlignment;
  224.     bool FAutoPopup;
  225.     Classes::TComponent* FPopupComponent;
  226.     Classes::TNotifyEvent FOnPopup;
  227.     void __fastcall DoPopup(System::TObject* Item);
  228.     HIDESBASE Classes::THelpContext __fastcall GetHelpContext(void);
  229.     void __fastcall SetHelpContext(Classes::THelpContext Value);
  230.     
  231. public:
  232.     __fastcall virtual TPopupMenu(Classes::TComponent* AOwner);
  233.     __fastcall virtual ~TPopupMenu(void);
  234.     virtual void __fastcall Popup(int X, int Y);
  235.     __property Classes::TComponent* PopupComponent = {read=FPopupComponent, write=FPopupComponent};
  236.     
  237. __published:
  238.     __property TPopupAlignment Alignment = {read=FAlignment, write=FAlignment, default=0};
  239.     __property bool AutoPopup = {read=FAutoPopup, write=FAutoPopup, default=1};
  240.     __property Classes::THelpContext HelpContext = {read=GetHelpContext, write=SetHelpContext, default=0
  241.         };
  242.     __property Classes::TNotifyEvent OnPopup = {read=FOnPopup, write=FOnPopup};
  243. };
  244.  
  245. //-- var, const, procedure ---------------------------------------------------
  246. #define scShift (Word)(8192)
  247. #define scCtrl (Word)(16384)
  248. #define scAlt (int)(32768)
  249. #define scNone (Byte)(0)
  250. extern PACKAGE TShortCut __fastcall ShortCut(Word Key, Classes::TShiftState Shift);
  251. extern PACKAGE void __fastcall ShortCutToKey(TShortCut ShortCut, Word &Key, Classes::TShiftState &Shift
  252.     );
  253. extern PACKAGE System::AnsiString __fastcall ShortCutToText(TShortCut ShortCut);
  254. extern PACKAGE TShortCut __fastcall TextToShortCut(System::AnsiString Text);
  255. extern PACKAGE TMainMenu* __fastcall NewMenu(Classes::TComponent* Owner, const System::AnsiString AName
  256.     , TMenuItem* const * Items, const int Items_Size);
  257. extern PACKAGE TPopupMenu* __fastcall NewPopupMenu(Classes::TComponent* Owner, const System::AnsiString 
  258.     AName, TPopupAlignment Alignment, bool AutoPopup, TMenuItem* const * Items, const int Items_Size);
  259. extern PACKAGE TMenuItem* __fastcall NewSubMenu(const System::AnsiString ACaption, Word hCtx, const 
  260.     System::AnsiString AName, TMenuItem* const * Items, const int Items_Size);
  261. extern PACKAGE TMenuItem* __fastcall NewItem(const System::AnsiString ACaption, TShortCut AShortCut, 
  262.     bool AChecked, bool AEnabled, Classes::TNotifyEvent AOnClick, Word hCtx, const System::AnsiString AName
  263.     );
  264. extern PACKAGE TMenuItem* __fastcall NewLine(void);
  265. extern PACKAGE System::AnsiString __fastcall StripHotKey(const System::AnsiString Text);
  266.  
  267. }    /* namespace Menus */
  268. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  269. using namespace Menus;
  270. #endif
  271. //-- end unit ----------------------------------------------------------------
  272. #endif    // Menus
  273.